package sys.dao;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import sys.entity.MenuEntity;
import sys.entity.RoleEntity;
import sys.entity.TbUserEntity;
import sys.entity.vo.Menu;
import sys.entity.vo.RoleVo;

import java.util.List;
import java.util.Map;


@Mapper
@Repository
public interface RoleDao extends BaseDao<RoleEntity> {
    @Insert("insert into tb_menu_role values(null,#{rid},#{mid})")
    void addRidAndMid(@Param("rid") Integer id,@Param("mid") Integer integer);

    void addRole(RoleVo roleVo);
    @Select("select menu_name menuName from tb_menu_role mr,tb_menu m where mr.menuid=m.id and roleid=#{id}")
    List<Map> selectMenu(Integer id);
    @Delete("delete from tb_menu_role where roleid=#{id}")
    void deleteMenuByRoleId(Integer id);

    void updateRole(RoleVo roleVo);
    @Select("select menuid from tb_menu_role where roleid=#{id}")
    Integer[] selectMenuId(Integer id);

}
